﻿<UserControl xmlns:Controls="clr-namespace:Flare.Controls"
             x:Class="Flare.Pages.Hards.Details"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             d:DesignHeight="600" d:DesignWidth="1200">

    <DockPanel LastChildFill="False">
        <TextBlock FontSize="16" Foreground="{StaticResource ColorText}" Text="{Binding type, FallbackValue=type}" DockPanel.Dock="Top" Margin="10,0,0,0" />
        <TextBlock Style="{StaticResource HeaderPageText}" DockPanel.Dock="Top" Margin="10,0,0,0">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0} {1}" FallbackValue="mark_model">
                    <Binding Path="mark" />
                    <Binding Path="model" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

        <DockPanel DockPanel.Dock="Top" LastChildFill="False" Margin="10,0,0,0">
            <Label Name="EditThis" Content="Редактировать" DockPanel.Dock="Left" Style="{StaticResource StyleUrl}" MouseLeftButtonUp="EditThis_MouseLeftButtonDown" />
            <Label Name="MoveThis" Content="Переместить" DockPanel.Dock="Left" Style="{StaticResource StyleUrl}" MouseLeftButtonUp="MoveThis_MouseLeftButtonDown" />
            <Label Name="RemoveThis" Content="Удалить" DockPanel.Dock="Left" Style="{StaticResource StyleUrl}" MouseLeftButtonUp="RemoveThis_MouseLeftButtonDown" />
        </DockPanel>

        <Controls:FlameTblock Header="Отдел" Content="{Binding department, FallbackValue=department}" Margin="10,40,0,0" DockPanel.Dock="Top" />
        <Controls:FlameTblock Header="Кабинет" Content="{Binding room, FallbackValue=room}" DockPanel.Dock="Top" Margin="10,0,0,0" />
        <Controls:FlameTblock Header="Инвентарный номер" Content="{Binding inventory_number, FallbackValue=inventory_number}" DockPanel.Dock="Top" Margin="10,0,0,0" />
        <Controls:FlameTblock Header="Заводской номер номер" Content="{Binding factory_number, FallbackValue=factory_number}" DockPanel.Dock="Top" Margin="10,0,0,0" />
        <Controls:FlameTblock Header="Примечание" Content="{Binding description, FallbackValue=description}" DockPanel.Dock="Top" Margin="10,0,0,0" />
        <Controls:FlameTblock Header="Дата заведения" Content="{Binding date_create, FallbackValue=date_create}" ContentStringFormat="yyyy.MM.dd" 
                              DockPanel.Dock="Top" Margin="10,0,0,0" />

        <TextBlock Text="История перемещения" Margin="10,40,0,0" DockPanel.Dock="Top" FontSize="20" FontFamily="Segoe UI Light" 
                   Foreground="{DynamicResource ColorTextBackground}" Visibility="{Binding Visibility, ElementName=History}" />

        <ScrollViewer x:Name="History" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" DockPanel.Dock="Top">
            <ScrollViewer.Style>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Items.Count, ElementName=itemsControl, Mode=OneWay}" Value="0">
                            <Setter Property="UIElement.Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ScrollViewer.Style>
            <ItemsControl x:Name="itemsControl" ItemsSource ="{Binding move_history}" ItemTemplate="{StaticResource HardListMoveHistoryTemplate}" IsTabStop="False">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Top"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </ScrollViewer>
    </DockPanel>
</UserControl>
